<?php
/**
 * Created by JetBrains PhpStorm.
 * User: xami
 * Date: 12-9-12
 * Time: 下午8:01
 * To change this template use File | Settings | File Templates.
 */
$id=Yii::app()->request->getParam('id',0);
$article=Article::model()->findByPk($id);
if(empty($article)){
    $this->renderPartial('//site/error',array(
        'message'=>'没有找到内容',
        'direct'=>$this->createUrl('manage/index',array('cate'=>9)),
    ));
    return;
}

if(isset($_POST['Article']))
{
    $article->audit=$_POST['Article']['audit'];
    $article->grade=$_POST['Article']['grade'];
    $article->save();

    $this->oz_info('更新成功');
    return;
}

$form=$this->beginWidget('CActiveForm', array(
    'id'=>'edit-form',
    'enableAjaxValidation'=>false,
)); ?>
<style type="text/css">
    div.row > label{
        display: inline-block;
        color: #0919BA;
    }
    table tr.tbs td > span{
        color: #000000;
    }

</style>

<?php echo $form->errorSummary($article); ?>

<div class="wp" style="min-height: 1335px">
    <table>
        <tr class="tbs">
            <td>标题： <span><?php echo $article->title;?></span></td>
        </tr>
        <tr>

        </tr>
        <tr class="tbs">
            <td>内容： </td>
        </tr>
        <tr>
            <td><p><?php echo nl2br($article->content);?></p> </td>
        </tr>
    </table>
    <br />
    <hr />      <br /><br />

    <div class="row">
        <?php echo $form->labelEx($article,'audit'); ?>
        <?php echo $form->radioButtonList($article,'audit',array('1'=>'通过','-1'=>'未通过'),array('separator'=>'&nbsp;')); ?>
        <?php echo $form->error($article,'audit'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($article,'grade'); ?>
        <?php echo $form->radioButtonList($article,'grade',array(1=>'1星',2=>'2星',3=>'3星',4=>'4星',5=>'5星'),array('separator'=>'&nbsp;')); ?>
        <?php echo $form->error($article,'grade'); ?>
    </div>

    <br />

    <div class="row buttons">
        <?php echo CHtml::submitButton($article->isNewRecord ? '提交' : '提交'); ?>
    </div>

    <?php $this->endWidget(); ?>
</div><!-- form -->

    <div class="clear"></div>
</div>